//
//  TestCollectionView.m
//  Demo
//
//  Created by yc on 2017/11/13.
//  Copyright © 2017年 lc4y. All rights reserved.
//

#import "TestCollectionView.h"
#import "TestCollectionViewCell.h"
#import "TestCollectionViewCell02.h"

@implementation TestCollectionView

// 设置section头视图的参考大小，与tableheaderview类似
- (CGSize)collectionView:(UICollectionView *)collectionView
                  layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
    if (self.cy_dataArray.count == 0) {
        return CGSizeZero;
    }
    return CGSizeMake([UIScreen mainScreen].bounds.size.width, 60);
}

//- (CGSize)collectionView:(UICollectionView *)collectionView
//                  layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
//    return CGSizeMake([UIScreen mainScreen].bounds.size.width, 60);
//}

- (NSString *)cy_cellIDWithIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.item == 0) {
        return @"TestCollectionViewCell";
    }
    return @"TestCollectionViewCell02";
}

- (NSString *)cy_sectionHeaderIDWithSection:(NSInteger)section {
    if (section == 0) {
        return @"TestCollectionSectionHeaderView";
    }
    return @"TestCollectionSectionFooterView";
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 2;
}



// 返回单元格的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    CGFloat width = [UIScreen mainScreen].bounds.size.width / 4;
    CGFloat height = 50;
    return CGSizeMake(width, height);
}

- (void)cy_didSelectCellRow:(NSIndexPath *)rowIndexPath {
    NSLog(@"点击了cell");
}

- (void)cy_refreshCell:(id)cell indexPath:(NSIndexPath *)indexPath {
    NSLog(@"刷新cell");
}

- (void)cy_refreshHeader:(id)headerView section:(NSInteger)section {
    NSLog(@"刷新SectionHeaderView");
}

- (void)cy_refreshFooter:(id)footerView section:(NSInteger)section {
    NSLog(@"刷新SectionFooterView");
}

@end
